/**
 * 
 */
package lt.vin.currency.client.ui;

import java.util.List;

import lt.vin.currency.client.service.CurrencyServiceAsync;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.MultiWordSuggestOracle;

/**
 * @author Vincentas
 *
 */
public class CurrencySuggest extends MultiWordSuggestOracle {

	public CurrencySuggest(CurrencyServiceAsync currencyService) {
		currencyService.getAvailableCurrencies(new AsyncCallback<List<String>>() {
			
			@Override
			public void onSuccess(List<String> result) {
				CurrencySuggest.this.addAll(result);
			}
			
			@Override
			public void onFailure(Throwable caught) {
				/*
				 * Ignore and have no suggestions or maybe add some default ones
				 */
			}
		});
	}
}
